const initState = {
  list: [] as Channel[],
}

export type Channel = {
  id: number
  name: string
}
export type ChannelAction = { type: 'channel/saveList'; payload: Channel[] }
export default function channelReducer(
  state = initState,
  action: ChannelAction
) {
  switch (action.type) {
    case 'channel/saveList':
      return { ...state, list: action.payload }
    default:
      return state
  }
}
